import { Form, InputNumber, Modal, Input,  Radio } from "antd";
import React from "react";


class UserViewModal extends React.Component{
    constructor(props){
        super(props);
        this.state={
            visible:false
        }
    }


    render(){

        const { getFieldDecorator } = this.props.form;
        const { viewVisible , onViewCancel ,userItem}=this.props;
        const formItemFormat = {
            labelCol:{span:4},
            wrapperCol:{span:18},
        };

        return(
            <div>
                <Modal
                title={"用户详情"}
                visible={viewVisible}
                onCancel={onViewCancel}
                cancelText="关闭"
                >
                    <Form>
                        <Form.Item  label="姓名" {...formItemFormat}>
                            {
                                getFieldDecorator(`name`,{
                                    initialValue: userItem.name || "",
                                })
                                  // eslint-disable-next-line
                                (
                                    <Input disabled />
                                )
                            }
                        </Form.Item>
                        <Form.Item label="年龄" {...formItemFormat}>
                            {
                                getFieldDecorator(`age`,{
                                    initialValue: userItem.age || "",
                                })
                                  // eslint-disable-next-line
                                (
                                    <InputNumber disabled/>
                                )
                            }
                        </Form.Item>
                        <Form.Item label="性别" {...formItemFormat}>
                            {
                                getFieldDecorator(`sex`,{
                                    initialValue: userItem.sex || "",
                                })
                                  // eslint-disable-next-line
                                (
                                    <Radio.Group>
                                      <Radio value={'男'} disabled>男</Radio>
                                      <Radio value={'女'} disabled>女</Radio>
                                    </Radio.Group>
                                )
                            }
                        </Form.Item>
                        <Form.Item label="地址" {...formItemFormat}>
                            {
                                getFieldDecorator(`address`,{
                                    initialValue: userItem.address || "",
                                })
                                  // eslint-disable-next-line
                                (
                                    <Input.TextArea rows={3} disabled />
                                )
                            }
                        </Form.Item>
                    </Form>
                </Modal>
            </div>

        )
    }
}

export default Form.create()(UserViewModal);
